import express from 'express';
import * as goldShopRouter from './goldShop.conteroller';
import { fileInterceptor, fileProcessor } from './goldShop.middleware';
import { validateLoginData, authGuard, userGuard } from '../auth/auth.middleware';

const router = express.Router();

/**
 * 获取内容
 */
router.get('/goldShop', userGuard, goldShopRouter.index);

/**
 * 获取内容(按 ID)
 */
router.get('/goldShop/:postId', userGuard, goldShopRouter.goldShopDetail);

/**
 * 创建内容
 */
router.post('/goldShop', authGuard, goldShopRouter.store);

/**
 * 更新内容
 */
router.patch('/goldShop/:postId', goldShopRouter.update);

/**
 * 删除内容
 */
router.post('/goldShopDestroy/:postId', authGuard, goldShopRouter.destroy);

/**
 * 修改状态
 */
router.patch('/goldShopStatus/:postId', authGuard, goldShopRouter.status);

/**
 * 上传文件
 */
router.post('/goldShopFiles', authGuard, fileInterceptor, fileProcessor, goldShopRouter.uploads);

/**
 * 文件服务
 */
router.get('/goldShopFiles/:fileId/serve', goldShopRouter.serve);

/**
 * 获取文件 ID
 */
router.post('/getGoldShopFilesId', goldShopRouter.getFileName)

/**
 * 导出路由
 */
export default router;
